package com.example.statement.machine.deadlock;

public class GrabLock2 {


    public synchronized void getLock1(GrabLock1 grabLock1){
        System.out.println("进入方法：GrabLock1.getLock1");

        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("试图获取GrabLock2的锁");

        grabLock1.getLock2();


    }

    public synchronized void getLock2(){
        System.out.println("进入方法+ GrabLock2.getLock2");
    }
}
